home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7123 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: hobbes.sco.COM!md
  2. From: md@sco.COM (Michael Davidson)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What's your compiler's answer?
  5. Date: 19 Feb 1996 07:55:20 GMT
  6. Organization: The Santa Cruz Operation, Inc.
  7. Message-ID: <4g9ad8$acg@hobbes.sco.COM>
  8. References: <1996Feb7.140945.28351@cs.rit.edu> <4fq0cq$h9s@hpbblb.bbn.hp.com> <danpop.824432113@rscernix> <4g2a1d$r33@solutions.solon.com>
  9. NNTP-Posting-Host: execsrvr.research.sco.com
  10. Cc: 
  11.  
  12.  
  13. In article <4g2a1d$r33@solutions.solon.com>,
  14. Peter Seebach <seebs@solutions.solon.com> wrote:
  15. >In article <danpop.824432113@rscernix>, Dan Pop <danpop@mail.cern.ch> wrote:
  16. >>j = i++, i++, i++;     /* equivalent to: j = i + 2; i += 3; */
  17. >
  18. >Don't you mean "/* equivalent to: j = i; i += 3; */"?
  19. >
  20. [ ... ]
  21. >
  22. >I can't seem to find mine, but I'm pretty sure that comma binds later than
  23. >assignment, or however you say it.  (Not "comma has lower precedence" - C
  24. >has no precedence, although it may act convincingly like it does.)
  25. >
  26. Apologies - please ignore my previous response to this (it's almost midnight,
  27. and I must be getting tired. You are, of course, perfectly correct - the
  28. comma operator does (to use the conventional word) have lower precedence
  29. than assignment.
  30.  
  31. So -
  32.  
  33. j = i++, i++, i++;
  34.  
  35. is indeed equivalent to: j = 1; i += 3;
  36.  
  37. for it to have been equivalent to:      j = i + 2; i += 3;
  38. it would have to have been written as:  j = (i++, i++, i++);
  39.  
  40. which, of course, it wasn't ...
  41.